<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class ChangeVideoFilesField extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('video_files', function (Blueprint $table) {
            if (Schema::hasColumn('video_files', 'image')) {
                $table->unsignedInteger('image')->change();
            }

            if (Schema::hasColumn('video_files', 'video')) {
                $table->unsignedInteger('video')->change();
            }
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('video_files', function (Blueprint $table) {
            if (Schema::hasColumn('video_files', 'image')) {
                $table->string('image')->change();
            }

            if (Schema::hasColumn('video_files', 'video')) {
                $table->string('video')->change();
            }
        });
    }
}
